<?php

session_start();
require_once( 'util.php' );

if (!can_post_new_page())
{
	report_err_and_exit( '必须以领队或者版主的身份登录' );
}

?>
<?php

require_once( 'Stencil.php' );
output_frame_header( '查看活动报名情况' );

?>
<link type="text/css" rel="stylesheet" href="style/validator.css"></link>
<link type="text/css" rel="stylesheet" href="style/user.css"></link>

 
<!-- 内容部分 -->
<div id="wp" class="wp ">
	<!-- 在此书写内容设计 -->
	<table>
		<tbody>
			<tr>
			<!-- 左边菜单栏 -->
			<td background="images/option.jpg">
				<?php require_once( 'settings.inc.php' ); ?>
			</td>
			<!-- 右边修改 -->
			<!-- 输出用户情况 -->
			<td>
				<table class="datelist" cellspacing="0" cellpadding="3" border="0"
					style="DISPLAY: block" >
					<tbody>
						<tr class="datelisthead">

							<td>活动名称</td>


							<td>报名志愿者</td>
							<td>电话</td>
							<td>E-mail</td>
							<td>QQ</td>
							<td>管理</td>
						</tr>
<?php

require( 'db.php' );
$sql = "SELECT page.subject, page.p_id, user.u_id, user.name, user.phone, user.mail, user.qq FROM activity, page, user WHERE page.u_id = {$_SESSION['u_id']} AND activity.p_id = page.p_id AND activity.u_id = user.u_id";
$result = mysql_query( $sql ) or report_err_and_exit( mysql_error() );

if ($result && mysql_num_rows( $result ))
{
	while ($row = mysql_fetch_array( $result ))
	{
		echo <<<ROD
						<tr>
							<td><a href="view_page.php?pid={$row['p_id']}">{$row['subject']}</td>
							<td>{$row['name']}</td>
							<td>{$row['phone']}</td>
							<td>{$row['mail']}</td>
							<td>{$row['qq']}</td>
							<td><input type="button" value="删除" onclick="deleteJoiner({$row['p_id']}, {$row['u_id']});"></td>
						</tr>
ROD;
	}
}
else
{
	echo '<tr class="datelisthead"><td colspan=6 style="color:red">真遗憾，没有任何人加入由您发起的活动中。</td></tr>';
}

?>
					</tbody>
				</table>
			</td>
		</tr>
	</tbody>

</table>

<form name="deleteJoinerForm" method="post" action="delete_joiner.php">
	<input type="hidden" id="aid" name="aid" />
	<input type="hidden" id="uid" name="uid" />
</form>

<script type="text/javascript" src="jquery.js"></script>
<script>

	function deleteJoiner(aid, uid) {
		$("#aid").val(aid);
		$("#uid").val(uid);
		
		document.deleteJoinerForm.submit();
	}

</script>

</div>
<?php

output_frame_footer();

?>